package ${packageName}.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tjs.wf.Result;

import ${packageName}.bean.${classType};
import ${packageName}.service.${classType}Service;

@Api(tags = "")
@RequestMapping(value = "/${format(className, "-")}")
@RestController
public class ${classType}Controller extends AbstractController {
	
	@Autowired
	private ${classType}Service ${className}Service;

	@ApiOperation("列表")
	@GetMapping
    public List<${classType}> list(${classType} ${className}) {
		return ${className}Service.list(${className});
    }

    @ApiOperation("分页列表")
    @GetMapping("/pageList")
    public IPage<${classType}> pageList(${classType} ${className}) {
        return ${className}Service.pageList(${className});
    }

    @ApiOperation("导出")
    @GetMapping("/report")
    public void report(${classType} ${className}, HttpServletResponse response) throws Exception {
        ${className}Service.report(${className},response);
    }

	@ApiOperation("详情")
	@GetMapping("/{${id}}")
    public ${classType} get(@PathVariable ${idType} ${id}) {
		return ${className}Service.get(${id});
    }

    @ApiOperation("编辑")
    @PostMapping
    public ${classType} save(@RequestBody ${classType} ${className}) {
		return ${className}Service.save(${className});
    }

    @PutMapping("/{${id}}")
    public ${classType} update(@RequestBody ${classType} ${className}) {
		return ${className}Service.update(${className});
    }

    @ApiOperation("删除")
    @DeleteMapping("/{${id}}")
    public Result delete(@PathVariable ${idType} ${id}) {
        ${className}Service.delete(${id});
    	return new Result();
    }
    
}